#box {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: center;
    margin: 50px;
    height: 500px;
}
body {
    text-align: center;
}
@keyframes moveInR {
    0% {
        left: 50%;
        width: 2px;
        margin: 5px 0;
    }
    50% {
        left: 0;
        width: 2px;
        margin: 5px 0;
    }
    100% {
        left: 0;
        width: 5px;
        margin: 5px;
    }
}
@keyframes moveInL {
    0% {
        left: -50%;
        width: 2px;
        margin: 5px 0;
    }
    50% {
        left: 0;
        width: 2px;
        margin: 5px 0;
    }
    100% {
        left: 0;
        width: 5px;
        margin: 5px;
    }
}
@keyframes moveOutL {
    0% {
        left: 0;
        width: 5px;
        margin: 5px 5px;
    }
    50% {
        left: 0;
        width: 5px;
    }
    100% {
        left: -50%;
        width: 0;
        margin: 5px 0;
        height: 5px;
    }
}
@keyframes moveOutR {
    0% {
        left: 0;
        width: 5px;
        margin: 5px 5px;
    }
    50% {
        left: 0;
        width: 5px;
    }
    100% {
        left: 50%;
        width: 0;
        margin: 5px 0;
        height: 5px;

    }
}
@keyframes LeftMove {
    0% {
        position: relative;
        left: 0;
    }
    100% {
        position: relative;
        background-color: yellow;
        left: -15px;
    }
}
@keyframes RightMove {
    0% {
        position: relative;
        left: 0;
    }
    100% {
        position: relative;
        background-color: yellow;
        left: 15px;
    }
}
.LeftMove {
    -webkit-animation: LeftMove 0.4s;
    -o-animation: LeftMove 0.4s;
    animation: LeftMove 0.4s;
}
.RightMove {
    -webkit-animation: RightMove 0.4s;
    -o-animation: RightMove 0.4s;
    animation: RightMove 0.4s;
}
.moveInL {
    -webkit-animation: moveInL 1s;
    -o-animation: moveInL 1s;
    animation: moveInL 1s;
}
.moveInR {
    -webkit-animation: moveInR 1s;
    -o-animation: moveInR 1s;
    animation: moveInR 1s;
}
.moveOutL {
    -webkit-animation: moveOutL 1s;
    -o-animation: moveOutL 1s;
    animation: moveOutL 1s;
}
.moveOutR {
    -webkit-animation: moveOutR 1s;
    -o-animation: moveOutR 1s;
    animation: moveOutR 1s;
}
#box>div {
    cursor: pointer;
    position: relative;
    -webkit-transition: left 1s;
    -moz-transition: left 1s;
    -o-transition: left 1s;
    transition: left 1s;
    width: 5px;
    background-color: red;
    margin: 5px;
}